<template>
  <div>
    <div class="pds-tip">
      <el-form :inline="true" :model="pageData.params" class="filter">
        <el-form-item label="关键字:">
          <el-input  v-model="pageData.params.searchKey"
            placeholder="请输入编号或标题" width="200px" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="search()">查询</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-table :data="tableData" border style=" margin: 15px auto;">
      <el-table-column width="50" align="center" label="序号">
        <template slot-scope="scope">
          {{(pageData.params.page-1)*pageData.params.limit+(scope.$index+1)}}
        </template>
      </el-table-column>
      <el-table-column prop="applyNo" label="编号" align="center" width='100px'></el-table-column>
      <el-table-column prop="title" label="标题" align="center"></el-table-column>
      <el-table-column prop="customerName" label="客户名称" align="center"></el-table-column>
      <el-table-column prop="applyUserName" label="申请人" align="center" width='80px'></el-table-column>
      <el-table-column prop="applyDate" label="申请日期" align="center" width='110px'></el-table-column>
      <el-table-column width="" align="center" label="状态">
        <template slot-scope="scope">
          <span v-if="scope.row.designStatus==0">待设计</span>
          <span v-if="scope.row.designStatus==1">设计中</span>
          <span v-if="scope.row.designStatus==2">审核中</span>
          <span v-if="scope.row.designStatus==3">已发布</span>
          <span v-if="scope.row.designStatus==4">驳回</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" width="220px">
        <template slot-scope="scope">
          <el-button type="success" size="small"  @click="$router.push({path:'/packing/design/view/designStructure',query:{applyId:scope.row.id}})">查看
          </el-button>
          <el-button type="primary" size="small"  @click="$router.push({path:'/packing/design/edit/designStructure',query:{applyId:scope.row.id}})" v-if="scope.row.applystatus!=3 && scope.row.applystatus!=2">处理
          </el-button>
          <el-button size="small" type="warning" v-if="scope.row.applystatus==3" @click="$router.push({path:'/packing/design/view/designStructure',query:{applyId:scope.row.id,type:'export'}})">导出
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination :pageData="pageData.params" @pageChange="changePage" @changeSize="changeSize"></pagination>
  </div>
</template>

<script>
import * as api from '@/api/packing/design/index';
export default {
  name: 'designStructure',
  data() {
    return {
      pageData: {
        params: {
          page: 1,
          limit: 10,
          searchKey:'',
          total: 10
        },
        list: []
      },
      currentCategory: '',
      tabName: 'first',
      pageData1: {
        params: {
          page: 1,
          limit: 10,
          applyNo: '',
          title: '',
          customerName: '',
          total: 10
        },
        list: []
      },
      tableData: [],
      tableData1: []
    };
  },
  created() {
    this.getList();
  },
  activated() {
    this.getList();
  },
  methods: {
    getList() {
      const params = this.pageData.params;
      api.getList(params).then(response => {
        if (response.code === 200) {
          this.tableData = response.data.rows;
          // this.pageData.params = Object.assign({}, { total: response.data.total });
          this.pageData.params.total = response.data.total;
        }
      });
    },
    addModule() {
      console.log(this.currentCategory);
    },
    search() {
      this.pageData.params.page = 1;
      this.getList();
    },
    changePage(pageData) {
      this.pageData.params.page = pageData.page;
      this.getList();
    },
    changeSize(pageSize) {
      this.pageData.params.limit = pageSize;
      this.pageData.params.page = 1;
      this.getList();
    },
    reset() {
      this.pageData.params = {
        page: 1,
        limit: 10,
        applyNo: '',
        title: '',
        customerName: ''
      };
      this.getList();
    },
    edit() {
      console.log(222222222222);
    }
  }
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.bigbox {
  width: 100%;
  background: #f5f5f5;
  overflow: hidden;
}
.pds-tip .filter {
    padding-top: 20px!important;
}
.el-header,
.el-footer {
  width: 300px;
  background-color: #ffffff;
  color: #333;
  text-align: center;
  line-height: 60px;
  border: 1px solid #ccc;
}

.el-aside {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  line-height: 200px;
}

.el-main {
  width: 300px;
  background-color: #fff;
  color: #333;
  text-align: center;
  line-height: 160px;
  margin-bottom: 30px;
  border: 1px solid #ccc;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}

.custom-tree-node {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  padding-right: 8px;
}

.el-tabs__header {
  margin: 0;
}

.pds-tip-green {
  padding: 8px 16px;
  background-color: #f8f8f8;
  border-radius: 4px;
  border-left: 5px solid #42b983;
  margin: 0 0 20px;

  p {
    font-size: 14px;
    color: #5e6d82;
    line-height: 1.5em;
    margin-top: 5px;
    margin-bottom: 5px;
  }
}
</style>
